var menuState={
    create:function() {
        game.add.image(0, 0, resRef.background);
        var nameLabel = game.add.text(game.world.centerX, -50, 'Super Coin Box',
            {font: '70px Geo', fill: '#fff'});
        nameLabel.anchor.setTo(0.5);
        game.add.tween(nameLabel).to({y:80},1000).easing(Phaser.Easing.Bounce.Out).start();
        //get bestScore from localStorage
        if(!localStorage.getItem('bestScore')){
            localStorage.setItem('bestScore',0);
        }
        if(game.global.score>localStorage.getItem('bestScore')){
            localStorage.setItem('bestScore',game.global.score);
        }
        var scoreLabel = game.add.text(game.world.centerX, game.world.centerY,
            'score: ' + game.global.score+
            '\nbest score: '+localStorage.getItem(('bestScore')), {font: '25px Arial', fill: '#fff',align:'center'});
        scoreLabel.anchor.setTo(0.5);
        if(game.device.desktop){
            var text='press the up arrow key to start';
        }else{
            var text='touch the screen to start';
        }
        var startLabel = game.add.text(game.world.centerX, game.world.height - 80,
            text,{font: '25px Arial', fill: '#fff'});
        startLabel.anchor.setTo(0.5);
        game.add.tween(startLabel).to({angle:-2},500).to({angle:2},1000).to(
            {angle:0},500).loop().start();
        var upKey = game.input.keyboard.addKey(Phaser.Keyboard.UP);
        upKey.onDown.addOnce(this.start, this);
        game.input.onDown.addOnce(this.start,this);
        this.muteButton=game.add.button(20,20,resRef.mute,this.toggleSound,this);
        this.muteButton.input.useHandCursor=true;
        if(game.sound.mute){
            this.muteButton.frame=1;
        }
    },
    toggleSound:function(){
        game.sound.mute=!game.sound.mute;
        this.muteButton.frame=game.sound.mute?1:0;
    },
    start:function(){
        game.state.start('play');
    }

}